export class dataProcessing {//处理数据 赛事数据处理
  constructor(arr,app) {
    let newDate = new Date().valueOf();
    arr.forEach(e=> {
      e.date = app.timeFn(e.timeStart, '-')[4]
      e.day = e.day.replace(/-/g, '/')
      e.shortAddress = e.shortAddress.replace(/,/g, '/')
      if (newDate < new Date(e.registTime).valueOf()) {
        e.state = 1
        // console.log('未开放报名')
      } else if (newDate >= new Date(e.registTime||e.registtime).valueOf() && newDate < new Date(e.deadlineRegist||e.deadlineregist).valueOf()) {
        e.state = 2
        // console.log('报名中')
      } else if (newDate >= new Date(e.deadlineRegist||e.deadlineregist).valueOf() && newDate < new Date(e.timeStart||e.timestart).valueOf()) {
        e.state = 3
        // console.log('已截止报名')
      } else if (newDate >= new Date(e.timeStart||e.timestart).valueOf() && newDate < new Date(e.timeEnd||e.timeend).valueOf()) {
        e.state = 4
        // console.log('进行中')
      } else if (newDate >= new Date(e.timeEnd||e.timeend).valueOf()) {
        e.state = 5
        // console.log('赛事已结束')
      }
    })
    return arr
  }
}